<!-- BEGIN PAGE HEADING ROW -->
<div class="row">
	<div class="col-lg-12">
		<!-- BEGIN BREADCRUMB -->
		<div class="breadcrumbs">
			<ul class="breadcrumb">
				<li> <a href="<?= $this->webroot.'admin' ?>">Trang chủ</a> </li>
				<li class="active">Danh sách tin tức</li>
			</ul>
		</div>
		<!-- END BREADCRUMB -->

		<div class="page-header">
			<h1>Danh Sách Tin Tức</h1>
		</div>

		<?php echo $this->element('layout/layout-options')?>

	</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
<!-- END PAGE HEADING ROW -->


<div class="row">
	<div class="col-lg-12">
		<?php echo $this->Session->flash(); ?>

		<div class="row row-top">
			<a href="<?= $this->webroot.'admin' ?>/news/add/" class="btn btn-primary"><i class="fa fa-plus"></i>Thêm mới</a>
		</div>

		<table class="table table-bordered table-striped table-hover tc-table table-primary footable" data-page-size="2">
			<thead>
				<tr>
					<th>Hình ảnh</th>
					<th>Tiêu đề</th>
					<th>Tên goi khác</th>
					<th>Miêu Tả</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<?php if(count($items) > 0):?>
				<?php foreach($items as $k => $v):?>
				<tr>
					<td style="width:10%" align="center"><?php echo !empty($v[$als]['image']) ? '<img style="width:80px;" src="'.PUBLIC_THUMB_SHOW.$v[$als]['image'].'" alt="" />' : ''; ?></td>
					<td style="width:20%"><?php echo $v[$als]['title'];?></td>
					<td style="width:20%"><?php echo $v[$als]['als'];?></td>
					<td><?php echo $v[$als]['desc'];?></td>
					<td class="col-medium center hidden-xs hidden-sm">
						<div class="action-buttons">
							<a href="<?= $this->webroot.'admin' ?>/news/add/<?php echo $v[$als]['id']?>" class="tooltip-green" data-placement="top" data-rel="tooltip" title="" data-original-title="Sửa"><i class="fa fa-edit bigger-130 text-green"></i></a>
							<a href="<?= $this->webroot.'admin' ?>/news/delete/<?php echo $v[$als]['id']?>" class="tooltip-red" data-placement="top" data-rel="tooltip" title="" data-original-title="Xóa"><i class="fa fa-trash-o bigger-130 text-red"></i></a>
						</div>
					</td>
				</tr>
				<?php endforeach; else:?>
				<tr>
					<td colspan="5"><div class="note note-primary">Chưa có tin tức</div></td>
				</tr>
				<?php endif; ?>
			</tbody>
			<?php $params = $this->Paginator->params(); if($params['pageCount'] > 1) :?>
			<tfoot>
				<tr>
					<td colspan="5" class="footable-visible">
						<?php echo $this->element('paging'); ?>
					</td>
				</tr>
			</tfoot>
			<?php endif; ?>
		</table>


	</div><!-- /.col-lg-12 -->
</div><!-- /.row -->

<?php
	echo $this->Html->script('plugins/bootbox/bootbox.min');
	echo $this->Html->script('functions');
?>

<script>
$( document ).ready(function($) {

	// xoa san pham
	$('.action-buttons .tooltip-red').click(function(event){
		event.preventDefault();
		var href =  $(this).attr('href');
		bootbox.confirm("Bạn có chắc chắn muốn xóa tin tức này không?", function(result) {
			if(result) {
				window.location.href = href;
			}
		});
		return false;
	});
});



</script>
